//
//  BJRiskShowView.m
//  SZBank
//
//  Created by rimi on 16/7/27.
//  Copyright © 2016年 LuoYao. All rights reserved.
//

#import "BJRiskShowView.h"

@interface BJRiskShowView ()
{
    CGFloat frameWidth;
    CGFloat frameHeight;
}
@end
@implementation BJRiskShowView

- (instancetype)initWithFrame:(CGRect)frame withDataArray:(NSArray *)dataArray
{
    self = [super initWithFrame:frame];
    if (self) {
        frameWidth = self.frame.size.width;
        frameHeight = self.frame.size.height;
        
        [self addViewsToSelfWithDataArray:dataArray];
    }
    return self;
}

- (void)addViewsToSelfWithDataArray:(NSArray *)dataArray{
    UIView *grayView = [[UIView alloc]initWithFrame:CGRectMake(0, frameHeight * 0.06, frameWidth, frameHeight * 0.06)];
    grayView.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:grayView];
    
    //横线
    for (int i  = 0; i < 2; i ++) {
        UIView *Hline = [[UIView alloc]initWithFrame:CGRectMake(0, frameHeight * 0.32 + frameHeight * 0.06 * i, frameWidth, frameHeight * 0.001)];
        Hline.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:Hline];
    }
    //竖线
    for (int i  = 0; i < 2; i ++) {
        UIView *Hline = [[UIView alloc]initWithFrame:CGRectMake(frameWidth * 0.15 + frameWidth * 0.1 * i, CGRectGetMaxY(grayView.frame) , frameHeight * 0.001,frameHeight * 0.2)];
        Hline.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:Hline];
    }
    //固定labe
    for (int i = 0; i < 10; i ++) {
        UILabel *label = [[UILabel alloc]init];
        label.font = [UIFont systemFontOfSize:FONT_SIZE];
       
        if (i == 0) {
            label.frame = CGRectMake(0, frameHeight * 0.32, frameWidth, frameHeight * 0.06);
            label.text = @"备注：本问卷的准确性视填写的答案而定，如有任何疑问，可以对投资产品是否适合投资做独立评估";
        }else if (i == 1){
            label.frame = CGRectMake(frameWidth * 0.4, frameHeight * 0.38, frameWidth * 0.2, frameHeight * 0.08);
            label.text = @"银行提示";
            label.textAlignment = NSTextAlignmentCenter;
            label.font = [UIFont systemFontOfSize:30.0];
        }else if (i == 2){
            label.frame = CGRectMake(0, 0, frameWidth * 0.2, frameHeight * 0.06);
            label.text = [NSString stringWithFormat:@"您的得分：%@",dataArray[0]];
        }else if ( i == 3){
            label.frame = CGRectMake(frameWidth * 0.5, 0, frameWidth * 0.3, frameHeight * 0.06);
            label.text = [NSString stringWithFormat:@"您的风险投资类型：%@",dataArray[1]];
        }else if (i == 4){
            label.frame = CGRectMake(0, frameHeight * 0.2, frameWidth * 0.15, frameHeight * 0.06);
            label.text = [NSString stringWithFormat:@"%@",dataArray[2]];
            
        }else if (i == 5){
            label.frame = CGRectMake(frameWidth * 0.15, frameHeight * 0.2, frameWidth * 0.1, frameHeight * 0.06);
            label.text = [NSString stringWithFormat:@"%@",dataArray[1]];
            

        }else if (i == 6){
            label.frame = CGRectMake(frameWidth * 0.26, frameHeight * 0.13, frameWidth * 0.7, frameHeight * 0.18);
            label.numberOfLines = 0;
            label.text = [NSString stringWithFormat:@"%@",dataArray[3]];
        }else if (i == 7){
            label.frame = CGRectMake(0, frameHeight * 0.06, frameWidth * 0.15, frameHeight * 0.06);
            label.text = @"得分";
        }else if (i == 8){
            label.frame = CGRectMake(frameWidth * 0.15, frameHeight * 0.06, frameWidth * 0.15, frameHeight * 0.06);
            label.text = @"类型";
        }
        
        
        else{
            label.frame = CGRectMake(0, frameHeight * 0.46, frameWidth, frameHeight * 0.3);
            label.numberOfLines = 0;
            label.text = @"       当您的财务状况发生较大变化或可能影响您风险承受能力的其他情况时，请及时通知我们并重新进行测试，以确保您的投资决定与您对风险所持的态度一致。以上测试旨在帮助您了解自己的风险偏好和风险承受能力，从而有助于您选择合适的产品投资。本测试以及资产配置建议可能并不全面和充分，最了解您的还是您自己。请根据自己的财务状况、收入预期，对资金的流动性要求、对风险的厌恶程度以及投资产品的特点等多种因素做出投资决策。请您在产品购买过程中注意核对自己的风险承受能力和产品风险的匹配情况，即使是激进的客户，也建议您做好资产在不同风险等级产品间的配置工作。如需帮助，建议您联系您的客户经理，得到进一步的资产配置建议。   \n           您提供的信息应当真是、准确、完整，我们的风险评价将基于您提供的有效信息，如您提供虚假、无效或不完整的信息，导致的评价结果出现错误，银行不承担相应的责任。";
        }
        
        [self addSubview:label];
    }

}

@end
